<template>
    <el-button type="primary" class="btnStatus" id="el-button-status">{{ CurrentCode }}</el-button>
</template>

<script setup name="StationStatusMonitor" lang="js">
import { ref, defineProps, defineEmits, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const emit = defineEmits(['setResult'])
const { CurrentCode } = defineProps(['CurrentCode'])

const colorBind = ref('#F56C6C');//动态变换颜色

proxy.signalr.SR.on(CurrentCode + "Status", (data_StationColor) => {
    console.log(data_StationColor);
    if (data_StationColor == '1') {
        //console.log('green');
        colorBind.value = '#67C23A'
    } else if (data_StationColor == '2') {
        colorBind.value = '#F56C6C'
    } else if (data_StationColor == '3') {
        colorBind.value = '#E6A23C'
    } else if (data_StationColor == '4') {
        colorBind.value = '#303133'
    }

})

</script>

<style scoped>
.btnStatus {
    background-color: v-bind('colorBind');
    width: 20px;
}
</style>